package hutool;

import cn.hutool.core.date.DateField;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;

import java.util.List;

public class hutooldate {
    public static void main(String[] args) {
        rangeToList();
    }
    public static void rangeToList() {
        DateTime dateTime = DateUtil.date();
        dateTime.offset(DateField.MONTH,-1);
        DateTime start = DateUtil.beginOfMonth(dateTime);
        DateTime end = DateUtil.endOfMonth(dateTime);
        List<DateTime> dateTimes = DateUtil.rangeToList(start, end, DateField.DAY_OF_YEAR);
        dateTimes.stream().forEach(time->{
            String startTime =DateUtil.format(time,"yyyy-MM-dd 06:00:00");
            String endTime = DateUtil.format(time.offset(DateField.DAY_OF_YEAR,1),"yyyy-MM-dd 05:59:59");
            System.out.println(startTime+"->"+endTime);
        });
    }
}
